<template>
  <div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
      <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title">
          <li>
            <router-link :to="{name:'login'}">登入</router-link>
          </li>
          <li class="layui-this">找回密码<!--重置密码--></li>
        </ul>
        <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <!-- 重置密码 -->
            <div class="layui-form layui-form-pane">
              <form method="post">
                <div class="layui-form-item">
                  <label for="L_email" class="layui-form-label">邮箱</label>
                  <validation-provider name="email" rules="required|email" v-slot="{errors}">
                    <div class="layui-input-inline">
                      <input type="text" id="L_email" name="username" required lay-verify="required" autocomplete="off"
                             v-model="username"
                             class="layui-input">
                    </div>
                    <div class="layui-form-mid">
                      <span style="color: #c00;">{{ errors[0] }}</span>
                    </div>
                  </validation-provider>

                </div>
                <div class="layui-form-item">
                  <label for="L_vercode" class="layui-form-label">验证码</label>
                  <validation-provider name="code" rules="required|length:4" v-slot="{errors}">
                    <div class="layui-input-inline">
                      <input type="text" id="L_vercode" name="code" required lay-verify="required"
                             v-model="code"
                             placeholder="请输入验证码" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid">
                      <span class="hlk-svg" v-html="svg"></span>
                    </div>
                    <div class="layui-form-mid">
                      <span style="color: #c00;">{{ errors[0] }}</span>
                    </div>
                  </validation-provider>
                </div>
                <div class="layui-form-item">
                  <button class="layui-btn" alert="1" lay-filter="*" lay-submit>提交</button>
                </div>
              </form>
            </div>

          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { ValidationProvider } from 'vee-validate'
import { getCode } from '@/api/login'

export default {
  name: 'forget',
  data () {
    return {
      svg: '',
      username: '',
      code: ''
    }
  },
  components: {
    ValidationProvider
  },
  async mounted () {
    this.svg = await getCode()
  }
}
</script>

<style lang='scss' scoped>
.hlk-svg {
  position: relative;
  top: -10px;
}
</style>
